package com.ufcg.lvc.client.prototipacao;

import java.util.List;

import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Position;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.logical.shared.AttachEvent;
import com.google.gwt.event.logical.shared.AttachEvent.Handler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DateLabel;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HasVerticalAlignment;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.ScrollPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.ufcg.lvc.client.GreetingService;
import com.ufcg.lvc.client.GreetingServiceAsync;

public class Inicio {

	AbsolutePanel rootPanel;
	List<String> listaTitulos;

	public static GreetingServiceAsync getServico() {
		return GWT.create(GreetingService.class);
	}

	public Inicio() {

		System.out.println("Tela inicial");
		// Add the nameField and sendButton to the RootPanel
		// Use RootPanel.get() to get the entire body element
		rootPanel = new AbsolutePanel();
		rootPanel.setStyleName("dialogVPanel");
		rootPanel.setSize("1160px", "790px");

		rootPanel.getElement().getStyle().setPosition(Position.RELATIVE);
		AbsolutePanel menuPanel = new AbsolutePanel();
		menuPanel.setStyleName("gwt-panelColorido");
		rootPanel.add(menuPanel, 0, 0);
		menuPanel.setSize("232px", "877px");

		VerticalPanel painelMenu = new VerticalPanel();
		painelMenu.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
		painelMenu.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
		menuPanel.add(painelMenu, 1, 88);
		painelMenu.setSize("250px", "276px");

		AbsolutePanel absolutePanel_2 = new AbsolutePanel();
		absolutePanel_2.setStyleName("gwt-Separador");
		painelMenu.add(absolutePanel_2);
		absolutePanel_2.setSize("252px", "1px");

		final ScrollPanel scrollPanel = new ScrollPanel();
		rootPanel.add(scrollPanel, 238, 64);
		scrollPanel.setSize("905px", "712px");

		Button btnQuestoes = new Button("Questões");
//		System.out.println(listaTitulos.get(0).toString());
		btnQuestoes.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				final MinhasQuestoes m = new MinhasQuestoes();
				scrollPanel.clear();
				scrollPanel.add(m.getPanel());
			}
		});
		btnQuestoes.setStyleName("gwt-Button_invisivel-Branco");
		painelMenu.add(btnQuestoes);
		btnQuestoes.setWidth("247px");

		AbsolutePanel absolutePanel_1 = new AbsolutePanel();
		painelMenu.add(absolutePanel_1);
		absolutePanel_1.setStyleName("gwt-Separador");
		absolutePanel_1.setSize("252px", "1px");

		Button btnModelosdeProva = new Button("Modelos de prova");
		btnModelosdeProva.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				final MeusModelosDeProva m = new MeusModelosDeProva();
				scrollPanel.clear();
				scrollPanel.add(m.getPanel());
			}
		});
		btnModelosdeProva.setText("Modelos de prova");
		btnModelosdeProva.setStyleName("gwt-Button_invisivel-Branco");
		painelMenu.add(btnModelosdeProva);
		btnModelosdeProva.setWidth("247px");

		AbsolutePanel absolutePanel_3 = new AbsolutePanel();
		absolutePanel_3.setStyleName("gwt-Separador");
		painelMenu.add(absolutePanel_3);
		absolutePanel_3.setSize("252px", "1px");

		Button btnAlunos = new Button("Alunos");
		btnAlunos.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
			}
		});
		btnAlunos.setText("Alunos");
		btnAlunos.setStyleName("gwt-Button_invisivel-Branco");
		painelMenu.add(btnAlunos);
		btnAlunos.setWidth("247px");
		btnAlunos.addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				final MeusAlunos m = new MeusAlunos();
				scrollPanel.clear();
				scrollPanel.add(m.getPanel());				
			}
		});

		AbsolutePanel absolutePanel_4 = new AbsolutePanel();
		absolutePanel_4.setStyleName("gwt-Separador");
		painelMenu.add(absolutePanel_4);
		absolutePanel_4.setSize("252px", "1px");

		Button btnTurmas = new Button("Turmas");
		btnTurmas.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				final MinhasTurmas m = new MinhasTurmas();
				scrollPanel.clear();
				scrollPanel.add(m.getPanel());
			}
		});
		btnTurmas.setStyleName("gwt-Button_invisivel-Branco");
		painelMenu.add(btnTurmas);
		btnTurmas.setWidth("247px");

		AbsolutePanel absolutePanel_5 = new AbsolutePanel();
		absolutePanel_5.setStyleName("gwt-Separador");
		painelMenu.add(absolutePanel_5);
		absolutePanel_5.setSize("252px", "1px");

		Button btnInstituicoes = new Button("Instituições");
		btnInstituicoes.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
			}
		});
		btnInstituicoes.setStyleName("gwt-Button_invisivel-Branco");
		painelMenu.add(btnInstituicoes);
		btnInstituicoes.setWidth("247px");

		AbsolutePanel absolutePanel_6 = new AbsolutePanel();
		absolutePanel_6.setStyleName("gwt-Separador");
		painelMenu.add(absolutePanel_6);
		absolutePanel_6.setSize("252px", "1px");

		Button btnConfiguraes = new Button("Configurações");
		btnConfiguraes.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				ConfigurarConta c = new ConfigurarConta();
				scrollPanel.clear();
				scrollPanel.add(c.getPanel());
			}
		});
		btnConfiguraes.setStyleName("gwt-Button_invisivel-Branco");
		painelMenu.add(btnConfiguraes);
		btnConfiguraes.setWidth("247px");

		AbsolutePanel absolutePanel_7 = new AbsolutePanel();
		absolutePanel_7.setStyleName("gwt-Separador");
		painelMenu.add(absolutePanel_7);
		absolutePanel_7.setSize("252px", "1px");

		Button btnCorrigeFacil = new Button("Corrige facil");
		btnCorrigeFacil.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
				scrollPanel.clear();
			}
		});
		btnCorrigeFacil.setStyleName("gwt-TituloGrande-P-para_Button");
		btnCorrigeFacil.setText("Corrige Fácil");
		menuPanel.add(btnCorrigeFacil, 1, 21);
		btnCorrigeFacil.setSize("231px", "61px");

		AbsolutePanel absolutePanel_8 = new AbsolutePanel();
		absolutePanel_8.setStyleName("gwt-Separador");
		rootPanel.add(absolutePanel_8, 238, 45);
		absolutePanel_8.setSize("912px", "3px");

		Button btnSair = new Button("Sair");
		btnSair.addClickHandler(new ClickHandler() {
			public void onClick(ClickEvent event) {
			}
		});
		btnSair.setStyleName("gwt-Button_invisivel_com_Borda");
		rootPanel.add(btnSair, 1048, 10);
		btnSair.setSize("102px", "29px");

		Label lblBemVindo = new Label("Bem vindo, João");
		lblBemVindo.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
		rootPanel.add(lblBemVindo, 238, 16);

		DateLabel dateLabel = new DateLabel();
		dateLabel.addAttachHandler(new Handler() {
			public void onAttachOrDetach(AttachEvent event) {
			}
		});
		dateLabel.setWordWrap(false);
		rootPanel.add(dateLabel, 970, 16);
		rootPanel.setVisible(true);

	}

	public AbsolutePanel getPanel() {
		return rootPanel;
	}
}